Skip to content

feat(gfql): PR 1.3 - Call Operations for safe method execution#707

Closed
lmeyerov wants to merge 11 commits into
feature/gfql-pr1-ast-nodesfrom
feature/gfql-pr1-3-call-operations
Closed

feat(gfql): PR 1.3 - Call Operations for safe method execution#707
lmeyerov wants to merge 11 commits into
feature/gfql-pr1-ast-nodesfrom
feature/gfql-pr1-3-call-operations

Conversation

@lmeyerov

@lmeyerov lmeyerov commented Jul 19, 2025

Copy link
Copy Markdown
Contributor

Summary

Implements ASTCall operations with comprehensive validation framework for safe method execution in GFQL.

Stack Position: #2 - Builds on PR #706's core AST infrastructure.

Stack Order

The complete GFQL stack (merge in this order):

  1. PR feat(gfql): PR 1.2 - Basic Working DAG execution #706: Core AST classes (ASTLet, ASTRemoteGraph, ASTChainRef)
  2. PR feat(gfql): PR 1.3 - Call Operations for safe method execution #707: This PR - ASTCall implementation with validation
  3. PR docs(gfql): Consolidate wire protocol documentation #709: GFQL directory restructuring and import path updates
  4. PR refactor: rename chain_dag to chain_let for semantic clarity #713: Rename chain_dag → chain_let for semantic consistency
  5. PR docs(gfql): Comprehensive Let bindings and Call operations documentation #708: Comprehensive documentation (rebased onto refactor: rename chain_dag to chain_let for semantic clarity #713)

Key Features

ASTCall - Safe Method Execution

  • Execute Plottable methods through GFQL with validation
  • Parameter type checking and safelist enforcement
  • Schema-aware validation for data operations
  • Comprehensive error handling with clear messages

Call Validation Framework

  • Safelist of allowed Plottable methods with parameter schemas
  • Type validators for all parameter types
  • Required vs optional parameter checking
  • Schema effects tracking (what columns are added/required)

Call Executor

  • Safe method execution with parameter validation
  • Engine parameter injection for methods that need it
  • Return type validation (ensures Plottable results)
  • Exception handling with context preservation

Safelist Configuration

Currently supports these validated methods:

  • get_degrees - Node degree calculations
  • filter_nodes_by_dict - Node filtering operations
  • filter_edges_by_dict - Edge filtering operations
  • hop - Graph traversal operations
  • Additional methods with full parameter validation

Validation Features

  • Parameter presence checking (required vs optional)
  • Type validation using configurable validators
  • Schema effect tracking for data pipeline safety
  • Clear error messages with suggestions for fixes

Error Handling

  • GFQLTypeError for type mismatches and missing parameters
  • Detailed field-specific error reporting
  • Exception chaining to preserve original errors
  • Suggestions for common parameter mistakes

Testing

  • Unit tests for call validation logic
  • Safelist configuration tests
  • Error handling and edge case tests
  • Integration with existing GFQL test suite

This PR enables safe execution of Plottable methods through GFQL, with comprehensive validation to prevent runtime errors and ensure data pipeline safety.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

@lmeyerov
lmeyerov force-pushed the feature/gfql-pr1-3-call-operations branch 5 times, most recently from cc3c6db to 2bf6b06 Compare July 21, 2025 11:36
@lmeyerov
lmeyerov force-pushed the feature/gfql-pr1-ast-nodes branch from 330049f to 4c36647 Compare July 21, 2025 17:26
@lmeyerov
lmeyerov force-pushed the feature/gfql-pr1-3-call-operations branch from 2bf6b06 to d7faad0 Compare July 21, 2025 17:27
@lmeyerov
lmeyerov force-pushed the feature/gfql-pr1-ast-nodes branch from 4c36647 to 7ef4751 Compare July 21, 2025 20:44
@lmeyerov
lmeyerov force-pushed the feature/gfql-pr1-3-call-operations branch from d7faad0 to f4bdab0 Compare July 21, 2025 21:07
@lmeyerov
lmeyerov force-pushed the feature/gfql-pr1-ast-nodes branch 4 times, most recently from 53b08cd to 73cf7ed Compare July 24, 2025 02:24
@lmeyerov
lmeyerov force-pushed the feature/gfql-pr1-3-call-operations branch 5 times, most recently from 7025999 to 60c8cd2 Compare July 25, 2025 00:03
@lmeyerov

Copy link
Copy Markdown
Contributor Author

Triggering CI after import fixes

lmeyerov and others added 6 commits July 26, 2025 01:27
- Add ASTCall node type for safe method execution
- Create safelist framework with method allowlists
- Implement parameter validation for exposed methods
- Add call execution support in chain_dag
- Include core graph methods (get_degrees, filter_by_dict, etc)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add 'call' alias for ASTCall to make the API more accessible
- Export 'call' from compute module
- Follows the pattern of other AST aliases (n, e, dag, ref, remote)

This completes the user-friendly aliasing for all public AST classes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Expand safelist with more Plottable methods (transformations, visual encoding, metadata)
- Add schema_effects metadata to track columns added/required by each method
- Implement _validate_call_op in validate_schema.py
- Hook Call validation into existing schema validation protocol
- Add comprehensive tests for Call schema validation
- Support dry-run validation with empty DataFrames

Methods now track:
- adds_node_cols: Columns added to nodes
- adds_edge_cols: Columns added to edges
- requires_node_cols: Node columns that must exist
- requires_edge_cols: Edge columns that must exist

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…tions

- Add detailed docstrings to all functions in call_safelist.py
- Add comprehensive docstrings to call_executor.py
- Add docstrings to ASTCall class and its methods in ast.py
- Add docstrings to _validate_call_op in validate_schema.py
- Create comprehensive GPU test coverage in test_call_operations_gpu.py
- Fix failing test that incorrectly used Call operations in chains
- Fix all linting issues (W292, E501)

The documentation now clearly explains:
- Purpose and behavior of each function
- Parameter types and validation rules
- Return values and exceptions
- Schema effects for static analysis

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Move call_executor.py and call_safelist.py to compute/gfql/ for better organization
- Update all imports to use new location
- All tests pass
lmeyerov and others added 4 commits July 26, 2025 01:28
- Move call_executor.py and call_safelist.py back to compute directory
- Update all imports to use original paths
- Remove empty gfql subdirectory that conflicted with gfql.py
- Fix ASTLet alias and type annotations
- Fix lint issues (newlines, comparison operators)
- Update test files to use ASTLet instead of deprecated ASTQueryDAG
- Add missing Any import to ast.py for ASTCall type hints
- Fixes import errors after rebasing onto PR #706 changes

This completes the rebase integration with the ASTQueryDAG → ASTLet rename.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@lmeyerov
lmeyerov force-pushed the feature/gfql-pr1-3-call-operations branch from f7bcbe1 to 2a57411 Compare July 26, 2025 08:29
lmeyerov added a commit that referenced this pull request Jul 26, 2025
Updates PR #709 to be compatible with the ASTChainRef → ASTRef refactoring
completed in PR #707. This ensures the PR stack remains consistent.

Changes:
- Rename ASTChainRef class to ASTRef in ast.py
- Update JSON type from 'ChainRef' to 'Ref'
- Update all references in chain_dag.py and validate_schema.py
- Fix import paths for call_executor and call_safelist
- Support both 'ChainRef' and 'Ref' JSON types for backward compatibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@lmeyerov

Copy link
Copy Markdown
Contributor Author

Superseded by PR #715 which consolidates all GFQL code changes into a single PR for easier review and testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant